ALMaSS  1.0
The Animal, Landscape and Man Simulation System
Skylark_Nestling Class Reference

#include <skylarks_all.h>

Inheritance diagram for Skylark_Nestling:
Skylark_Base TAnimal TALMaSSObject Skylark_PreFledgeling

Public Member Functions

 Skylark_Nestling (int x, int y, Skylark_Male *Daddy, Landscape *L, SkTerritories *Terrs, Skylark_Population_Manager *SPM, int bx, int by, int mh)
 
virtual void ReInit (int x, int y, Skylark_Male *Daddy, Landscape *L, SkTerritories *Terrs, Skylark_Population_Manager *SPM, int bx, int by, int mh)
 
virtual void BeginStep (void)
 BeingStep behaviour - must be implemented in descendent classes. More...
 
virtual void Step (void)
 Step behaviour - must be implemented in descendent classes. More...
 
virtual void EndStep (void)
 EndStep behaviour - must be implemented in descendent classes. More...
 
virtual double On_FoodSupply (double food)
 
void OnDadDead ()
 
void OnYouHaveBeenEaten ()
 
void OnDeserted ()
 
- Public Member Functions inherited from Skylark_Base
 Skylark_Base (int x, int y, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
 
virtual void ReInit (int x, int y, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
 
void AddStriglingMort (int lifestage)
 
virtual int WhatState ()
 
bool InSquare (rectangle R)
 
- Public Member Functions inherited from TAnimal
unsigned SupplyFarmOwnerRef ()
 
AnimalPosition SupplyPosition ()
 
APoint SupplyPoint ()
 
int SupplyPolygonRef ()
 
int Supply_m_Location_x ()
 
int Supply_m_Location_y ()
 
virtual void KillThis ()
 
virtual void CopyMyself ()
 
void SetX (int a_x)
 
void SetY (int a_y)
 
 TAnimal (int x, int y, Landscape *L)
 
virtual void ReinitialiseObject (int x, int y, Landscape *L)
 Used to re-use an object - must be implemented in descendent classes. More...
 
virtual void Dying ()
 
void CheckManagement (void)
 
void CheckManagementXY (int x, int y)
 
- Public Member Functions inherited from TALMaSSObject
int GetCurrentStateNo ()
 Returns the current state number. More...
 
void SetCurrentStateNo (int a_num)
 Sets the current state number. More...
 
bool GetStepDone ()
 Returns the step done indicator flag. More...
 
void SetStepDone (bool a_bool)
 Sets the step done indicator flag. More...
 
virtual void ReinitialiseObject ()
 Used to re-use an object - must be implemented in descendent classes. More...
 
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
 
virtual ~TALMaSSObject ()
 The destructor for TALMaSSObject. More...
 
void OnArrayBoundsError ()
 Used for debugging only, tests basic object properties. More...
 

Protected Member Functions

virtual int st_Developing ()
 
virtual void st_Maturing ()
 
virtual void st_Dying ()
 
virtual bool OnFarmEvent (FarmToDo event)
 
virtual void PesticideResponse (void)
 
- Protected Member Functions inherited from Skylark_Base
bool DailyMortality (int mort)
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 

Protected Attributes

bool Sex
 
int m_EM_fail
 
int m_NestLeavingChance
 
Skylark_Malem_Dad
 
double m_EM
 
double m_GrNeed
 
- Protected Attributes inherited from TAnimal
int m_Location_x
 
int m_Location_y
 
Landscapem_OurLandscape
 
- Protected Attributes inherited from TALMaSSObject
int m_CurrentStateNo
 The basic state number for all objects - '-1' indicates death. More...
 
bool m_StepDone
 Indicates whether the iterative step code is done for this timestep. More...
 

Additional Inherited Members

- Public Attributes inherited from Skylark_Base
double m_pesticide_accumulation
 
double m_pcide_conc
 
TTypesOfSkState m_CurrentSkState
 
int Age
 
double m_Size
 
int m_Born_x
 
int m_Born_y
 
int m_MyHome
 The vegetation type where the skylark was born. More...
 
SkTerritoriesm_OurTerritories
 
Skylark_Population_Managerm_OurPopulationManager
 

Constructor & Destructor Documentation

◆ Skylark_Nestling()

Skylark_Nestling::Skylark_Nestling ( int  x,
int  y,
Skylark_Male Daddy,
Landscape L,
SkTerritories Terrs,
Skylark_Population_Manager SPM,
int  bx,
int  by,
int  mh 
)
2934  : Skylark_Base(x, y, Terrs, L, SPM, bx, by, mh) {
2935  m_Dad = Daddy;
2936  //Growth = 0;
2937  // Must choose sex
2938  if (random(2) == 1) Sex = true; else
2939  Sex = false; // M or F
2940  m_Size = MeanHatchingWeight + (((random(25) - 11) * MeanHatchingWeight) / 1000.0);
2941  Age = 1;
2942  m_EM_fail = 0;
2943  // From Skylarks Energy Calcs Mar05.xls
2944  m_EM = 0.3058 * m_Size + 0.5221;
2945  m_GrNeed = cfg_PEmax.value(); // No of Kcals possible to use for growth on day 1
2947 }
int random(int a_range)
Definition: ALMaSS_CmdLine.cpp:142
double value(void)
Definition: configurator.h:118
int value(void)
Definition: configurator.h:98
double m_Size
Definition: skylarks_all.h:596
int Age
Definition: skylarks_all.h:595
Skylark_Base(int x, int y, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
Definition: skylarks_all.cpp:2435
int m_EM_fail
Definition: skylarks_all.h:682
int m_NestLeavingChance
Definition: skylarks_all.h:683
bool Sex
Definition: skylarks_all.h:681
double m_EM
Definition: skylarks_all.h:686
Skylark_Male * m_Dad
Definition: skylarks_all.h:685
double m_GrNeed
Definition: skylarks_all.h:687
static double MeanHatchingWeight
Definition: skylarks_all.cpp:179
CfgInt cfg_NestLeavingChance
CfgFloat cfg_PEmax

References Skylark_Base::Age, cfg_NestLeavingChance, cfg_PEmax, m_Dad, m_EM, m_EM_fail, m_GrNeed, m_NestLeavingChance, Skylark_Base::m_Size, MeanHatchingWeight, random(), Sex, CfgInt::value(), and CfgFloat::value().

Member Function Documentation

◆ BeginStep()

void Skylark_Nestling::BeginStep ( void  )
virtual

BeingStep behaviour - must be implemented in descendent classes.

Reimplemented from TAnimal.

Reimplemented in Skylark_PreFledgeling.

3109  {
3110  // If you are not dead already find out if you are killed today by agriculture
3111  if ( m_CurrentStateNo != -1 ) CheckManagement();
3112 }
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:116
void CheckManagement(void)
Definition: PopulationManager.cpp:1404

References TAnimal::CheckManagement(), and TALMaSSObject::m_CurrentStateNo.

◆ EndStep()

void Skylark_Nestling::EndStep ( void  )
virtual

EndStep behaviour - must be implemented in descendent classes.

Reimplemented from TAnimal.

Reimplemented in Skylark_PreFledgeling.

3142  {
3143 #ifdef __CJTDebug_5
3144  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
3145 #endif
3146  if ( m_CurrentSkState == toss_Destroy ) return;
3147 #ifdef __CJTDebug_5
3148  if ( Dad )
3149  if ( !Dad->DoIExistN( this ) ) {
3150  g_land->Warn( "Skylark_Nestling::EndStep - Do I ExistN ", NULL ); exit( 1 );
3151  }
3152 #endif
3153  switch ( m_CurrentSkState ) {
3154  case toss_NDeveloping: // Develop
3155  switch ( st_Developing() ) {
3156  case 3:
3157  if ( m_Dad != NULL ) m_Dad->OnNestPredatation(); // Kill the whole brood
3158  break;
3159  case 2:
3160 #ifdef TEST_ISSUE_DEATH_WARRANT
3161  printf( "Skylark_Nestling::EndStep() : st_Developing() %d\n", ( int )g_date->Date() );
3162 #endif
3163  m_CurrentSkState = toss_NDying; // die
3164  break;
3165  case 1:
3166  // Maturing must be called here because it happens the same day as develop
3167  st_Maturing(); // Do Maturing
3169  m_CurrentStateNo = -1;
3170  m_StepDone = true;
3171  break;
3172  }
3173  break;
3174  case toss_NDying: // Dying
3175  st_Dying();
3176  m_StepDone = true;
3177  break;
3178  default:
3179  /* char errornum[20]; sprintf(errornum, "%d", m_CurrentSkState );
3180  g_land->Warn("Skylark_Nestling::EndStep(): Unknown state: ", errornum); exit(0); */
3181  break;
3182  }
3183 #ifdef __PESTICIDE_RA
3185 #endif
3186 }
class Calendar * g_date
Definition: calendar.cpp:38
long Date(void)
Definition: calendar.h:57
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579
TTypesOfSkState m_CurrentSkState
Definition: skylarks_all.h:594
void OnNestPredatation()
Definition: skylarks_all.cpp:4886
virtual int st_Developing()
Definition: skylarks_all.cpp:3190
virtual void st_Dying()
Definition: skylarks_all.cpp:3344
virtual void st_Maturing()
Definition: skylarks_all.cpp:3251
virtual void PesticideResponse(void)
Definition: skylarks_all.cpp:6826
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:118
Landscape * g_land
This pointer provides access the to landscape module.
Definition: skylarks_all.cpp:49
@ toss_NDying
Definition: skylarks_all.h:49
@ toss_Destroy
Definition: skylarks_all.h:62
@ toss_NDeveloping
Definition: skylarks_all.h:49

References Calendar::Date(), g_date, g_land, Skylark_Base::m_CurrentSkState, TALMaSSObject::m_CurrentStateNo, m_Dad, TALMaSSObject::m_StepDone, Skylark_Male::OnNestPredatation(), PesticideResponse(), st_Developing(), st_Dying(), st_Maturing(), toss_Destroy, toss_NDeveloping, toss_NDying, and Landscape::Warn().

◆ On_FoodSupply()

double Skylark_Nestling::On_FoodSupply ( double  food)
virtual

Reimplemented from Skylark_Base.

3312  {
3313 #ifdef __CJTDebug_5
3314  if ( IsAlive() != 0xDEADC0DE )
3315  DEADCODEError();
3316 #endif
3317 
3318  if ( m_EM > 0 ) // Must maintain this
3319  {
3320  if ( a_food > m_EM ) {
3321  a_food -= m_EM;
3322  m_EM = 0;
3323  } else {
3324  m_EM -= a_food;
3325  a_food = 0;
3326  }
3327  }
3328  if ( m_GrNeed > a_food ) {
3329  m_GrNeed -= a_food;
3330  // Does the growing here
3331  m_Size += a_food * CE_nest[ Age ]; // Conv Eff is g dw insect to g ww bird
3332  a_food = 0;
3333  } else {
3334  // Does the growing here at the maximum allowed rate
3335  m_Size += m_GrNeed * CE_nest[ Age ]; // Conv Eff is g dw insect to g ww bird
3336  a_food -= m_GrNeed;
3337  m_GrNeed = 0;
3338  }
3339  return a_food;
3340 }
const double CE_nest[15]
Definition: skylarks_all.cpp:167

References Skylark_Base::Age, CE_nest, m_EM, m_GrNeed, and Skylark_Base::m_Size.

Referenced by Skylark_Male::OnFoodMessage(), and Skylark_Male::st_CaringForYoung().

◆ OnDadDead()

void Skylark_Nestling::OnDadDead ( )
3278  {
3279 #ifdef __CJTDebug_5
3280  if ( IsAlive() != 0xDEADC0DE )
3281  DEADCODEError();
3282 #endif
3283  // Dad is dead - so must not send him a message
3284  // So forget who he is (messaging to Dad must be checked for NULL on sending)
3285  m_Dad = NULL;
3286 }

References m_Dad.

Referenced by Skylark_Male::OnMateDying(), Skylark_Male::OnMateLeaving(), Skylark_Male::st_Dying(), and Skylark_Male::st_ScaringOffChicks().

◆ OnDeserted()

void Skylark_Nestling::OnDeserted ( )
3301  {
3302  // Nobody to tell, nothing to do but vanish as soon as possible
3304  m_CurrentStateNo = -1;
3305 #ifdef __SKPOM
3307 #endif
3308 }
int SupplyDayInYear(void)
Definition: landscape.h:1596
Skylark_Population_Manager * m_OurPopulationManager
Definition: skylarks_all.h:603
void WriteSKPOM2(int n, int n2)
Definition: skylarks_all.h:482
Landscape * m_OurLandscape
Definition: PopulationManager.h:229

References Skylark_Base::m_CurrentSkState, TALMaSSObject::m_CurrentStateNo, TAnimal::m_OurLandscape, Skylark_Base::m_OurPopulationManager, Landscape::SupplyDayInYear(), toss_Destroy, and Skylark_Population_Manager::WriteSKPOM2().

Referenced by Skylark_Male::OnBroodDesertion().

◆ OnFarmEvent()

bool Skylark_Nestling::OnFarmEvent ( FarmToDo  event)
protectedvirtual

Reimplemented from TAnimal.

Reimplemented in Skylark_PreFledgeling.

2967  {
2968  switch ( event ) {
2969  case sleep_all_day:
2970  case fp_npks:
2971  case fp_npk:
2972  case fp_pk:
2973  case fp_manganesesulphate:
2974  case fp_manure:
2975  case fp_greenmanure:
2976  case fp_sludge:
2977  case fa_npk:
2978  case fa_pk:
2979  case fa_ammoniumsulphate:
2980  case fa_manure:
2981  case fa_sludge:
2982  case herbicide_treat:
2983  case growth_regulator:
2984  case fungicide_treat:
2985  case insecticide_treat:
2987  case molluscicide:
2988  case water:
2989  case hay_bailing:
2990  case cut_weeds:
2991  break;
2992 
2993  case autumn_harrow:
2994  case autumn_roll:
2995  case autumn_sow:
2996  case winter_plough:
2997  case deep_ploughing:
2998  case spring_plough:
2999  case spring_harrow:
3000  case spring_roll:
3001  case spring_sow:
3002  case autumn_plough:
3003  case fp_liquidNH3:
3004  case fa_greenmanure:
3005  case row_cultivation:
3006  case hilling_up:
3007  case harvest:
3008  case cut_to_hay:
3009  case cut_to_silage:
3010  case straw_chopping:
3011  case hay_turning:
3012  case stubble_harrowing:
3014  case burn_straw_stubble:
3015  case mow:
3016 #ifdef TEST_ISSUE_DEATH_WARRANT
3017  printf( "Skylark_Nestling::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
3018 #endif
3020  break;
3021 
3022  case fp_slurry:
3023  case fa_slurry:
3024  case swathing:
3025  if ( random( 100 ) < 2 ) {
3026 #ifdef TEST_ISSUE_DEATH_WARRANT
3027  printf( "Skylark_Nestling::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
3028 #endif
3030  }
3031  break;
3032 
3033  case syninsecticide_treat:
3034  if ( random( 1000 ) < cfg_insecticide_direct_mortN.value() ) {
3035 #ifdef TEST_ISSUE_DEATH_WARRANT
3036  printf( "Skylark_Nestling::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
3037 #endif
3039  }
3040  break;
3041 
3042  case strigling:
3043 #ifndef __NoStriglingEffect
3044  if ( random( 100 ) < cfg_strigling_nestling.value() ) {
3045  #ifdef TEST_ISSUE_DEATH_WARRANT
3046  printf( "Skylark_Nestling::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
3047  #endif
3049  AddStriglingMort( 2 );
3050  }
3051 #endif
3052  break;
3053 
3054  case cattle_out:
3056  if ( random( 1000 ) < 20 ) {
3057 #ifdef TEST_ISSUE_DEATH_WARRANT
3058  printf( "Skylark_Nestling::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
3059 #endif
3061  }
3062  break;
3063 
3064  case cattle_out_low:
3066  if ( random( 1000 ) < 5 ) {
3067 #ifdef TEST_ISSUE_DEATH_WARRANT
3068  printf( "Skylark_Nestling::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
3069 #endif
3071  }
3072  break;
3073 
3074  case pigs_out:
3075 #ifndef __NoPigsOutEffect
3076  if ( random( 100 ) < 20 ) {
3077  #ifdef TEST_ISSUE_DEATH_WARRANT
3078  printf( "Skylark_Nestling::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
3079  #endif
3081  }
3082 #endif
3083  break;
3084  case strigling_sow:
3085 #ifndef __NoStriglingEffect
3086  if ( random( 100 ) < cfg_strigling_nestling.value() ) {
3087  #ifdef TEST_ISSUE_DEATH_WARRANT
3088  printf( "Skylark_Nestling::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
3089  #endif
3091  AddStriglingMort( 2 );
3092  }
3093 #endif
3094  break;
3095  case product_treat:
3096  break;
3097  case glyphosate:
3098  break;
3099  default:
3100  g_land->Warn( "Skylark_Nestling::OnFarmEvent(): ""Unknown event type:", m_OurLandscape->EventtypeToString( event ) );
3101  exit( 1 );
3102  }
3103  if ( m_CurrentSkState == toss_NDying ) return true; else
3104  return false;
3105 }
std::string EventtypeToString(int a_event)
Definition: Landscape.cpp:3918
int SupplyGrazingPressure(int a_polyref)
Definition: landscape.h:1227
void AddStriglingMort(int lifestage)
Definition: skylarks_all.h:611
int m_Location_y
Definition: PopulationManager.h:228
int m_Location_x
Definition: PopulationManager.h:225
CfgInt cfg_insecticide_direct_mortN
CfgInt cfg_strigling_nestling
@ burn_straw_stubble
Definition: treatment.h:92
@ autumn_harrow
Definition: treatment.h:37
@ swathing
Definition: treatment.h:81
@ fa_pk
Definition: treatment.h:62
@ winter_plough
Definition: treatment.h:42
@ strigling
Definition: treatment.h:77
@ fp_npks
Definition: treatment.h:48
@ glyphosate
Definition: treatment.h:102
@ fa_sludge
Definition: treatment.h:68
@ fp_liquidNH3
Definition: treatment.h:51
@ spring_roll
Definition: treatment.h:46
@ fa_greenmanure
Definition: treatment.h:67
@ spring_plough
Definition: treatment.h:44
@ molluscicide
Definition: treatment.h:75
@ syninsecticide_treat
Definition: treatment.h:99
@ hay_turning
Definition: treatment.h:88
@ autumn_roll
Definition: treatment.h:38
@ fp_manure
Definition: treatment.h:55
@ deep_ploughing
Definition: treatment.h:43
@ pigs_out
Definition: treatment.h:84
@ fa_npk
Definition: treatment.h:61
@ herbicide_treat
Definition: treatment.h:71
@ row_cultivation
Definition: treatment.h:76
@ spring_sow
Definition: treatment.h:47
@ fungicide_treat
Definition: treatment.h:73
@ fp_manganesesulphate
Definition: treatment.h:53
@ harvest
Definition: treatment.h:82
@ cut_to_silage
Definition: treatment.h:86
@ sleep_all_day
Definition: treatment.h:33
@ mow
Definition: treatment.h:93
@ fa_ammoniumsulphate
Definition: treatment.h:65
@ autumn_plough
Definition: treatment.h:34
@ straw_chopping
Definition: treatment.h:87
@ fa_manure
Definition: treatment.h:66
@ fp_greenmanure
Definition: treatment.h:56
@ fa_slurry
Definition: treatment.h:63
@ product_treat
Definition: treatment.h:101
@ stubble_harrowing
Definition: treatment.h:90
@ hilling_up
Definition: treatment.h:79
@ growth_regulator
Definition: treatment.h:72
@ insecticide_treat
Definition: treatment.h:74
@ trial_insecticidetreat
Definition: treatment.h:96
@ cattle_out_low
Definition: treatment.h:100
@ cut_to_hay
Definition: treatment.h:85
@ cut_weeds
Definition: treatment.h:94
@ fp_sludge
Definition: treatment.h:57
@ autumn_sow
Definition: treatment.h:41
@ fp_npk
Definition: treatment.h:49
@ fp_pk
Definition: treatment.h:50
@ hay_bailing
Definition: treatment.h:89
@ spring_harrow
Definition: treatment.h:45
@ strigling_sow
Definition: treatment.h:95
@ cattle_out
Definition: treatment.h:83
@ fp_slurry
Definition: treatment.h:52
@ water
Definition: treatment.h:80
@ autumn_or_spring_plough
Definition: treatment.h:91

References Skylark_Base::AddStriglingMort(), autumn_harrow, autumn_or_spring_plough, autumn_plough, autumn_roll, autumn_sow, burn_straw_stubble, cattle_out, cattle_out_low, cfg_insecticide_direct_mortN, cfg_strigling_nestling, cut_to_hay, cut_to_silage, cut_weeds, Calendar::Date(), deep_ploughing, Landscape::EventtypeToString(), fa_ammoniumsulphate, fa_greenmanure, fa_manure, fa_npk, fa_pk, fa_sludge, fa_slurry, fp_greenmanure, fp_liquidNH3, fp_manganesesulphate, fp_manure, fp_npk, fp_npks, fp_pk, fp_sludge, fp_slurry, fungicide_treat, g_date, g_land, glyphosate, growth_regulator, harvest, hay_bailing, hay_turning, herbicide_treat, hilling_up, insecticide_treat, Skylark_Base::m_CurrentSkState, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, molluscicide, mow, pigs_out, product_treat, random(), row_cultivation, sleep_all_day, spring_harrow, spring_plough, spring_roll, spring_sow, straw_chopping, strigling, strigling_sow, stubble_harrowing, Landscape::SupplyGrazingPressure(), swathing, syninsecticide_treat, toss_NDying, trial_insecticidetreat, CfgInt::value(), Landscape::Warn(), water, and winter_plough.

◆ OnYouHaveBeenEaten()

void Skylark_Nestling::OnYouHaveBeenEaten ( )

◆ PesticideResponse()

void Skylark_Nestling::PesticideResponse ( void  )
protectedvirtual

Reimplemented from Skylark_Base.

Reimplemented in Skylark_PreFledgeling.

6827 {
6829  // NOEL triggered, so we need to die
6831  }
6833 }
double m_pesticide_accumulation
Definition: skylarks_all.h:592
CfgFloat cfg_Skylark_nestling_NOEL
CfgFloat cfg_Skylark_nestling_Biodegredation

References cfg_Skylark_nestling_Biodegredation, cfg_Skylark_nestling_NOEL, Skylark_Base::m_CurrentSkState, Skylark_Base::m_pesticide_accumulation, Skylark_Base::m_Size, toss_NDying, and CfgFloat::value().

Referenced by EndStep().

◆ ReInit()

void Skylark_Nestling::ReInit ( int  x,
int  y,
Skylark_Male Daddy,
Landscape L,
SkTerritories Terrs,
Skylark_Population_Manager SPM,
int  bx,
int  by,
int  mh 
)
virtual
2950  {
2951  Skylark_Base::ReInit(x, y, Terrs, L, SPM, bx, by, mh);
2952  m_Dad = Daddy;
2953  //Growth = 0;
2954  // Must choose sex
2955  if (random(2) == 1) Sex = true; else
2956  Sex = false; // M or F
2957  m_Size = MeanHatchingWeight + (((random(25) - 11) * MeanHatchingWeight) / 1000.0);
2958  Age = 1;
2959  m_EM_fail = 0;
2960  // From Skylarks Energy Calcs Mar05.xls
2961  m_EM = 0.3058 * m_Size + 0.5221;
2962  m_GrNeed = cfg_PEmax.value(); // No of Kcals possible to use for growth on day 1
2964 }
virtual void ReInit(int x, int y, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
Definition: skylarks_all.cpp:2449

References Skylark_Base::Age, cfg_NestLeavingChance, cfg_PEmax, m_Dad, m_EM, m_EM_fail, m_GrNeed, m_NestLeavingChance, Skylark_Base::m_Size, MeanHatchingWeight, random(), Skylark_Base::ReInit(), Sex, CfgInt::value(), and CfgFloat::value().

Referenced by Skylark_PreFledgeling::ReInit().

◆ st_Developing()

int Skylark_Nestling::st_Developing ( )
protectedvirtual

Reimplemented in Skylark_PreFledgeling.

3191 {
3192  // On entry GrNeed is set to the remaining food that could have been eaten
3193  // today
3194 #ifdef __CJTDebug_5
3195  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
3196 #endif
3197  // Timing of this function call is at the last moment of each day
3198  if ( DailyMortality( NestlingMortProb ) ) {
3199  return 3; //send brood eaten to Dad, will call OnYouHaveBeenEaten for all nestlings
3200  }
3201  // EM will be 0 if enough food has been given
3202 /*
3203 if ( m_EM > 0 )
3204  {
3205  if ( m_EM_fail > 2 )
3206  {
3207 #ifdef __SKPOM
3208  m_OurPopulationManager->WriteSKPOM2( m_OurLandscape->SupplyDayInYear(), 2002 );
3209 #endif
3210  return 2; //TransferToState(Die) Did not get EM for 2 days
3211  }
3212  } else
3213  {
3214  m_EM_fail = 0; // got EM so unset flag
3215  }
3216 */
3217  if ( Age >= 6 )
3218  {
3219  if ( m_Size >= NestLeavingWeight )
3220  {
3221  if ( random( 100 ) < m_NestLeavingChance ) {
3222 #ifdef __SKPOM
3224 #endif
3225  return 1;
3226  } else
3227  m_NestLeavingChance *= 4;
3228  }
3229  }
3230  if ( Age == 11 )
3231  {
3232 #ifdef __SKPOM
3234 #endif
3235  return 2; // Taken too long so die
3236  }
3237  Age++; // age
3238  // From Skylarks Energy Calcs Mar05.xls
3239  if ( Age < 6 ) m_EM = 0.31 * m_Size + 0.52; else
3240  m_EM = 0.24 * m_Size + 6.83;
3241  // Below is the correction for thermoregulation (Below 4days this is really a
3242  // female cost - but it is subtracted here instead).
3243  // Assumes that 50% of the time (night) that the chicks are covered and at 36)
3244  // EM += EM_nest_T[ Age ] * ( 36 - ( ( 0.5 * m_OurLandscape->SupplyTemp() ) + 18 ) );
3245  m_EM += EM_nest_T[ Age ] * ( 36 - ( m_OurLandscape->SupplyTemp() ) );
3246  m_GrNeed = cfg_PEmax.value();
3247  return 0; // still growing and not dead
3248 }
double SupplyTemp(void)
Definition: landscape.h:1386
bool DailyMortality(int mort)
Definition: skylarks_all.cpp:2464
static double NestLeavingWeight
Definition: skylarks_all.cpp:173
const double EM_nest_T[14]
Definition: skylarks_all.cpp:161
static int NestlingMortProb
Definition: skylarks_all.cpp:177

References Skylark_Base::Age, cfg_PEmax, Skylark_Base::DailyMortality(), EM_nest_T, m_EM, m_GrNeed, m_NestLeavingChance, TAnimal::m_OurLandscape, Skylark_Base::m_OurPopulationManager, Skylark_Base::m_Size, NestLeavingWeight, NestlingMortProb, random(), Landscape::SupplyDayInYear(), Landscape::SupplyTemp(), CfgFloat::value(), and Skylark_Population_Manager::WriteSKPOM2().

Referenced by EndStep().

◆ st_Dying()

void Skylark_Nestling::st_Dying ( void  )
protectedvirtual

Reimplemented in Skylark_PreFledgeling.

3344  {
3345 #ifdef __CJTDebug_5
3346  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
3347 #endif
3348  // Timing: Zero time
3349  // Only called before object is destroyed
3350  // Checks that Dad exists
3351  if ( m_Dad != NULL ) m_Dad->OnNestlingDeath( this );
3352  m_CurrentSkState = toss_Destroy; // will kill it at end of step!
3353  m_CurrentStateNo = -1;
3354 }
void OnNestlingDeath(Skylark_Nestling *N)
Definition: skylarks_all.cpp:4850

References Skylark_Base::m_CurrentSkState, TALMaSSObject::m_CurrentStateNo, m_Dad, Skylark_Male::OnNestlingDeath(), and toss_Destroy.

Referenced by EndStep().

◆ st_Maturing()

void Skylark_Nestling::st_Maturing ( )
protectedvirtual

Reimplemented in Skylark_PreFledgeling.

3251  {
3252 #ifdef __CJTDebug_5
3253  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
3254 #endif
3255  if ( !m_Dad ) return; // If Dad is gone then something went wrong and we died
3256  // Timing: Occurs at 1 minute to midnight
3257  // When created they must update dads pointer
3258  PreFledgeling_struct * fps;
3259  fps = new PreFledgeling_struct;
3260  fps->x = m_Location_x;
3261  fps->y = m_Location_y;
3262  fps->size = m_Size;
3263  fps->Dad = m_Dad;
3264  fps->age = Age;
3265  fps->L = m_OurLandscape;
3266  fps->Terrs = m_OurTerritories;
3267  fps->sex = Sex;
3268  fps->bx = m_Born_x;
3269  fps->by = m_Born_y;
3270  fps->mh = m_MyHome;
3271  m_OurPopulationManager->CreateObjects( 2, this, NULL, fps, 1 );
3272  delete fps;
3273  // m_OurPopulationManager will destroy object
3274 }
Definition: skylarks_all.h:238
int age
Definition: skylarks_all.h:243
bool sex
Definition: skylarks_all.h:242
double size
Definition: skylarks_all.h:240
Skylark_Male * Dad
Definition: skylarks_all.h:241
int m_MyHome
The vegetation type where the skylark was born.
Definition: skylarks_all.h:600
int m_Born_y
Definition: skylarks_all.h:598
SkTerritories * m_OurTerritories
Definition: skylarks_all.h:602
int m_Born_x
Definition: skylarks_all.h:597
void CreateObjects(int ob_type, TAnimal *pTAo, void *null, Skylark_struct *data, int number)
Definition: skylarks_all.cpp:557
int bx
Definition: skylarks_all.h:200
Landscape * L
Definition: skylarks_all.h:203
int x
Definition: skylarks_all.h:198
SkTerritories * Terrs
Definition: skylarks_all.h:204
int y
Definition: skylarks_all.h:199
int mh
Definition: skylarks_all.h:202
int by
Definition: skylarks_all.h:201

References PreFledgeling_struct::age, Skylark_Base::Age, Skylark_struct::bx, Skylark_struct::by, Skylark_Population_Manager::CreateObjects(), PreFledgeling_struct::Dad, Skylark_struct::L, Skylark_Base::m_Born_x, Skylark_Base::m_Born_y, m_Dad, TAnimal::m_Location_x, TAnimal::m_Location_y, Skylark_Base::m_MyHome, TAnimal::m_OurLandscape, Skylark_Base::m_OurPopulationManager, Skylark_Base::m_OurTerritories, Skylark_Base::m_Size, Skylark_struct::mh, PreFledgeling_struct::sex, Sex, PreFledgeling_struct::size, Skylark_struct::Terrs, Skylark_struct::x, and Skylark_struct::y.

Referenced by EndStep().

◆ Step()

void Skylark_Nestling::Step ( void  )
virtual

Step behaviour - must be implemented in descendent classes.

Reimplemented from TAnimal.

Reimplemented in Skylark_PreFledgeling.

3116  {
3117 #ifdef __CJTDebug_5
3118  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
3119 #endif
3120  if ( m_StepDone ) return;
3121  switch ( m_CurrentSkState ) {
3122  case toss_Initiation: // Initial
3124  m_StepDone = true;
3125  break;
3126  case toss_Destroy:
3127  m_StepDone = true;
3128  break;
3129  case toss_NDeveloping: // Develop
3130  m_StepDone = true;
3131  break;
3132  case toss_NDying: // Dying
3133  m_StepDone = true;
3134  break;
3135  default:
3136  g_land->Warn( "Skylark_Nestling::Step(): Unknown State ", NULL ); exit( 1 );
3137  }
3138 }
@ toss_Initiation
Definition: skylarks_all.h:45

References g_land, Skylark_Base::m_CurrentSkState, TALMaSSObject::m_StepDone, toss_Destroy, toss_Initiation, toss_NDeveloping, toss_NDying, and Landscape::Warn().

Member Data Documentation

◆ m_Dad

◆ m_EM

◆ m_EM_fail

int Skylark_Nestling::m_EM_fail
protected

Referenced by ReInit(), and Skylark_Nestling().

◆ m_GrNeed

◆ m_NestLeavingChance

int Skylark_Nestling::m_NestLeavingChance
protected

◆ Sex


The documentation for this class was generated from the following files: